package com.iris.live.services.data.models;

import javax.persistence.*;

/**
 * Created by HangLiu on 2016/12/27.
 */
@Entity
@Table(name = "t_weekly_sm2_ros_rpt", schema = "live", catalog = "")
public class TWeeklySm2RosRptModel {
    private Integer id;
    private String updateDate;
    private String permit;
    private String segment;
    private String classis;
    private String modelDe;
    private String model;
    private Integer customerOrderWeekly;//周订单数
    private Integer customerOrderMtd;//月订单数
    private Integer customerOrderYtd;//年订单数
    private Integer customerOrderTotalUnfulfilled;//尚未开票订单
    private Integer retailSaleWeekly;//周零售
    private Integer retailSaleMtd;//月零售
    private Integer retailSaleYtd;//年零售
    private Integer stockWithOrder;//有订单库存
    private Integer stockWithoutOrder;//无订单库存
    private Integer stockPendingForInvoice;//已交车未开票库存
    private String allocationYear1;//前两年各月生存未卖车统计
    private String allocationYear2;//前一年各月生产未卖车统计
    private String allocationYear3;//今年各月生产未卖车统计
    private String orderRequirementPlan;//各月厂家配额
    private Integer retailSaleWithoutGivecar;//开票未交车零售
    private Integer wholesaleNotintoStorage;//约发但尚未到店的库存车辆


    private boolean insertType;



    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "ID")
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Basic
    @Column(name = "UPDATE_DATE")
    public String getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(String updateDate) {
        this.updateDate = updateDate;
    }

    @Basic
    @Column(name = "PERMIT")
    public String getPermit() {
        return permit;
    }

    public void setPermit(String permit) {
        this.permit = permit;
    }

    @Basic
    @Column(name = "SEGMENT")
    public String getSegment() {
        return segment;
    }

    public void setSegment(String segment) {
        this.segment = segment;
    }

    @Basic
    @Column(name = "CLASSIS")
    public String getClassis() {
        return classis;
    }

    public void setClassis(String classis) {
        this.classis = classis;
    }

    @Basic
    @Column(name = "MODEL_DE")
    public String getModelDe() {
        return modelDe;
    }

    public void setModelDe(String modelDe) {
        this.modelDe = modelDe;
    }

    @Basic
    @Column(name = "MODEL")
    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    @Basic
    @Column(name = "CUSTOMER_ORDER_WEEKLY")
    public Integer getCustomerOrderWeekly() {
        return customerOrderWeekly;
    }

    public void setCustomerOrderWeekly(Integer customerOrderWeekly) {
        this.customerOrderWeekly = customerOrderWeekly;
    }

    @Basic
    @Column(name = "CUSTOMER_ORDER_MTD")
    public Integer getCustomerOrderMtd() {
        return customerOrderMtd;
    }

    public void setCustomerOrderMtd(Integer customerOrderMtd) {
        this.customerOrderMtd = customerOrderMtd;
    }

    @Basic
    @Column(name = "CUSTOMER_ORDER_YTD")
    public Integer getCustomerOrderYtd() {
        return customerOrderYtd;
    }

    public void setCustomerOrderYtd(Integer customerOrderYtd) {
        this.customerOrderYtd = customerOrderYtd;
    }

    @Basic
    @Column(name = "CUSTOMER_ORDER_TOTAL_UNFULFILLED")
    public Integer getCustomerOrderTotalUnfulfilled() {
        return customerOrderTotalUnfulfilled;
    }

    public void setCustomerOrderTotalUnfulfilled(Integer customerOrderTotalUnfulfilled) {
        this.customerOrderTotalUnfulfilled = customerOrderTotalUnfulfilled;
    }

    @Basic
    @Column(name = "RETAIL_SALE_WEEKLY")
    public Integer getRetailSaleWeekly() {
        return retailSaleWeekly;
    }

    public void setRetailSaleWeekly(Integer retailSaleWeekly) {
        this.retailSaleWeekly = retailSaleWeekly;
    }

    @Basic
    @Column(name = "RETAIL_SALE_MTD")
    public Integer getRetailSaleMtd() {
        return retailSaleMtd;
    }

    public void setRetailSaleMtd(Integer retailSaleMtd) {
        this.retailSaleMtd = retailSaleMtd;
    }

    @Basic
    @Column(name = "RETAIL_SALE_YTD")
    public Integer getRetailSaleYtd() {
        return retailSaleYtd;
    }

    public void setRetailSaleYtd(Integer retailSaleYtd) {
        this.retailSaleYtd = retailSaleYtd;
    }

    @Basic
    @Column(name = "STOCK_WITH_ORDER")
    public Integer getStockWithOrder() {
        return stockWithOrder;
    }

    public void setStockWithOrder(Integer stockWithOrder) {
        this.stockWithOrder = stockWithOrder;
    }

    @Basic
    @Column(name = "STOCK_WITHOUT_ORDER")
    public Integer getStockWithoutOrder() {
        return stockWithoutOrder;
    }

    public void setStockWithoutOrder(Integer stockWithoutOrder) {
        this.stockWithoutOrder = stockWithoutOrder;
    }

    @Basic
    @Column(name = "STOCK_PENDING_FOR_INVOICE")
    public Integer getStockPendingForInvoice() {
        return stockPendingForInvoice;
    }

    public void setStockPendingForInvoice(Integer stockPendingForInvoice) {
        this.stockPendingForInvoice = stockPendingForInvoice;
    }

    @Basic
    @Column(name = "ALLOCATION_YEAR_1")
    public String getAllocationYear1() {
        return allocationYear1;
    }

    public void setAllocationYear1(String allocationYear1) {
        this.allocationYear1 = allocationYear1;
    }

    @Basic
    @Column(name = "ALLOCATION_YEAR_2")
    public String getAllocationYear2() {
        return allocationYear2;
    }

    public void setAllocationYear2(String allocationYear2) {
        this.allocationYear2 = allocationYear2;
    }

    @Basic
    @Column(name = "ALLOCATION_YEAR_3")
    public String getAllocationYear3() {
        return allocationYear3;
    }

    public void setAllocationYear3(String allocationYear3) {
        this.allocationYear3 = allocationYear3;
    }

    @Basic
    @Column(name = "ORDER_REQUIREMENT_PLAN")
    public String getOrderRequirementPlan() {
        return orderRequirementPlan;
    }

    public void setOrderRequirementPlan(String orderRequirementPlan) {
        this.orderRequirementPlan = orderRequirementPlan;
    }

    @Basic
    @Column(name = "RETAIL_SALE_WITHOUT_GIVECAR")
    public Integer getRetailSaleWithoutGivecar() {
        return retailSaleWithoutGivecar;
    }

    public void setRetailSaleWithoutGivecar(Integer retailSaleWithoutGivecar) {
        this.retailSaleWithoutGivecar = retailSaleWithoutGivecar;
    }

    @Basic
    @Column(name = "WHOLESALE_NOTINTO_STORAGE")
    public Integer getWholesaleNotintoStorage() {
        return wholesaleNotintoStorage;
    }

    public void setWholesaleNotintoStorage(Integer wholesaleNotintoStorage) {
        this.wholesaleNotintoStorage = wholesaleNotintoStorage;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TWeeklySm2RosRptModel that = (TWeeklySm2RosRptModel) o;

        if (id != null ? !id.equals(that.id) : that.id != null) return false;
        if (updateDate != null ? !updateDate.equals(that.updateDate) : that.updateDate != null) return false;
        if (permit != null ? !permit.equals(that.permit) : that.permit != null) return false;
        if (segment != null ? !segment.equals(that.segment) : that.segment != null) return false;
        if (classis != null ? !classis.equals(that.classis) : that.classis != null) return false;
        if (modelDe != null ? !modelDe.equals(that.modelDe) : that.modelDe != null) return false;
        if (model != null ? !model.equals(that.model) : that.model != null) return false;
        if (customerOrderWeekly != null ? !customerOrderWeekly.equals(that.customerOrderWeekly) : that.customerOrderWeekly != null)
            return false;
        if (customerOrderMtd != null ? !customerOrderMtd.equals(that.customerOrderMtd) : that.customerOrderMtd != null)
            return false;
        if (customerOrderYtd != null ? !customerOrderYtd.equals(that.customerOrderYtd) : that.customerOrderYtd != null)
            return false;
        if (customerOrderTotalUnfulfilled != null ? !customerOrderTotalUnfulfilled.equals(that.customerOrderTotalUnfulfilled) : that.customerOrderTotalUnfulfilled != null)
            return false;
        if (retailSaleWeekly != null ? !retailSaleWeekly.equals(that.retailSaleWeekly) : that.retailSaleWeekly != null)
            return false;
        if (retailSaleMtd != null ? !retailSaleMtd.equals(that.retailSaleMtd) : that.retailSaleMtd != null)
            return false;
        if (retailSaleYtd != null ? !retailSaleYtd.equals(that.retailSaleYtd) : that.retailSaleYtd != null)
            return false;
        if (stockWithOrder != null ? !stockWithOrder.equals(that.stockWithOrder) : that.stockWithOrder != null)
            return false;
        if (stockWithoutOrder != null ? !stockWithoutOrder.equals(that.stockWithoutOrder) : that.stockWithoutOrder != null)
            return false;
        if (stockPendingForInvoice != null ? !stockPendingForInvoice.equals(that.stockPendingForInvoice) : that.stockPendingForInvoice != null)
            return false;
        if (allocationYear1 != null ? !allocationYear1.equals(that.allocationYear1) : that.allocationYear1 != null)
            return false;
        if (allocationYear2 != null ? !allocationYear2.equals(that.allocationYear2) : that.allocationYear2 != null)
            return false;
        if (allocationYear3 != null ? !allocationYear3.equals(that.allocationYear3) : that.allocationYear3 != null)
            return false;
        if (orderRequirementPlan != null ? !orderRequirementPlan.equals(that.orderRequirementPlan) : that.orderRequirementPlan != null)
            return false;
        if (retailSaleWithoutGivecar != null ? !retailSaleWithoutGivecar.equals(that.retailSaleWithoutGivecar) : that.retailSaleWithoutGivecar != null)
            return false;
        if (wholesaleNotintoStorage != null ? !wholesaleNotintoStorage.equals(that.wholesaleNotintoStorage) : that.wholesaleNotintoStorage != null)
            return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (updateDate != null ? updateDate.hashCode() : 0);
        result = 31 * result + (permit != null ? permit.hashCode() : 0);
        result = 31 * result + (segment != null ? segment.hashCode() : 0);
        result = 31 * result + (classis != null ? classis.hashCode() : 0);
        result = 31 * result + (modelDe != null ? modelDe.hashCode() : 0);
        result = 31 * result + (model != null ? model.hashCode() : 0);
        result = 31 * result + (customerOrderWeekly != null ? customerOrderWeekly.hashCode() : 0);
        result = 31 * result + (customerOrderMtd != null ? customerOrderMtd.hashCode() : 0);
        result = 31 * result + (customerOrderYtd != null ? customerOrderYtd.hashCode() : 0);
        result = 31 * result + (customerOrderTotalUnfulfilled != null ? customerOrderTotalUnfulfilled.hashCode() : 0);
        result = 31 * result + (retailSaleWeekly != null ? retailSaleWeekly.hashCode() : 0);
        result = 31 * result + (retailSaleMtd != null ? retailSaleMtd.hashCode() : 0);
        result = 31 * result + (retailSaleYtd != null ? retailSaleYtd.hashCode() : 0);
        result = 31 * result + (stockWithOrder != null ? stockWithOrder.hashCode() : 0);
        result = 31 * result + (stockWithoutOrder != null ? stockWithoutOrder.hashCode() : 0);
        result = 31 * result + (stockPendingForInvoice != null ? stockPendingForInvoice.hashCode() : 0);
        result = 31 * result + (allocationYear1 != null ? allocationYear1.hashCode() : 0);
        result = 31 * result + (allocationYear2 != null ? allocationYear2.hashCode() : 0);
        result = 31 * result + (allocationYear3 != null ? allocationYear3.hashCode() : 0);
        result = 31 * result + (orderRequirementPlan != null ? orderRequirementPlan.hashCode() : 0);
        result = 31 * result + (retailSaleWithoutGivecar != null ? retailSaleWithoutGivecar.hashCode() : 0);
        result = 31 * result + (wholesaleNotintoStorage != null ? wholesaleNotintoStorage.hashCode() : 0);
        return result;
    }

    @Transient
    public boolean getInsertType() {
        if (  ( customerOrderWeekly != null && customerOrderWeekly != 0)
                || ( customerOrderMtd != null && customerOrderMtd != 0)
                || ( customerOrderYtd != null && customerOrderYtd != 0)
                ||  (customerOrderTotalUnfulfilled != null && customerOrderTotalUnfulfilled != 0)
                ||  (retailSaleWeekly != null && retailSaleWeekly != 0)
                ||  (retailSaleMtd != null && retailSaleMtd != 0)
                ||  (retailSaleYtd != null && retailSaleYtd != 0)
                ||  (stockWithOrder != null && stockWithOrder != 0)
                ||  (stockWithoutOrder != null && stockWithoutOrder != 0)
                ||  (stockPendingForInvoice != null && stockPendingForInvoice != 0)
                ||  (allocationYear1 != null&&!allocationYear1.equals("0|0|0|0|0|0|0|0|0|0|0|0")   )
                ||  ( allocationYear2 != null&&!allocationYear2.equals("0|0|0|0|0|0|0|0|0|0|0|0")  )
                ||  (allocationYear3 != null&&!allocationYear3.equals("0|0|0|0|0|0|0|0|0|0|0|0") )
                ||  (retailSaleWithoutGivecar != null && retailSaleWithoutGivecar != 0)
                ||  (wholesaleNotintoStorage != null && wholesaleNotintoStorage != 0)) {
            insertType = true;
        } else {
            insertType = false;
        }
        return insertType;
    }

    public void setInsertType(boolean insertType) {
        this.insertType = insertType;
    }

}
